import React, { Component } from "react";

import Child from "./Child";

class App extends Component {
  state = {
    num: 20,
  };
  render() {
    return (
      <>
        <h2>新版生命周期</h2>
        <Child num={this.state.num} />
      </>
    );
  }
  componentDidMount() {
    setTimeout(() => {
      this.setState({
        num: 40,
      });
    }, 2000);
  }
}

export default App;
